#include"Channel.h"
#include"common.h"
Channel::Channel(Epoll* ep,int fd):_ep(ep),_fd(fd),events(0),_revents(0),_inEpoll(false)
{}

void Channel::enableRead()
{
    setnonblocking(_fd);
    events=EPOLLET|EPOLLIN;
    _ep->updateChannel(this);
}
int Channel::getFd()
{
    return _fd;
}
uint32_t Channel::getEvents()
{
    return events;
}
uint32_t Channel::getRevents()
{
    return _revents;
}
bool Channel::getInEpoll()
{
    return _inEpoll;
}
void Channel::setInEpoll()
{
    _inEpoll=true;
}

Channel::~Channel()
{
    _ep==nullptr;
    _fd=-1;
}

void Channel::setRevents(uint32_t ev)
{
   _revents=ev;
}
